function checkFile()
{
	var flag = true;
	var fileName = $("#file").val();
	if(fileName == "" || (fileName.indexOf(".txt") == -1 && fileName.indexOf(".csv") == -1) )
	{ 
		alert("Please select .txt or .csv for upload file");
		flag = false;
	}
	var radio1 = $("input[@name='radio1']:checked").val();
	if(radio1 == "" || radio1 == null)
	{
		alert("Please select one of the types SQL or CSV");
		flag = false;
	}
	return flag;
}


function checkText()
{
	flag = true;
	if($("#text").val() != "")
	{
		flag = true;
	}else{
		alert("Plase mister insert some text");
		flag = false;
	}
	var radio2 = $("input[@name='radio2']:checked").val();
	if(radio2 == "" || radio2 == null)
	{
		alert("Please select one of the types SQL or CSV");
		flag = false;
	}
	return flag;
}




function changeTable()
{
	var valTable = $("#selectTable").val();
	$("#selTable").val(valTable);
	document.hiddenform.submit();
	//document.location = "download.psp?selTable=" + valTable;
}








function setMenuArrow(){
	function setMenuArrow2()
	{
		if(typeof(oSelected)=="undefined") oArrow.style.visibility="hidden";
		else {
			oArrow.style.left=oSelected.offsetLeft+oSelected.offsetWidth/2-9+"px";
			oArrow.style.visibility="visible";
		}
	}
	oArrow=document.getElementById("menuarrow").getElementsByTagName("img")[0];
	aItems=document.getElementById("menu").getElementsByTagName("li");
	for(i=0;i<aItems.length;i++){
		if(aItems[i].className.indexOf("selected")!=-1) {
			oSelected=aItems[i];
		}
	}
	setMenuArrow2();
	for(i=0;i<aItems.length;i++){
		if(aItems[i].id!="menuarrow"){
			aItems[i].onmouseover=function(){
				oArrow.style.left=this.offsetLeft+this.offsetWidth/2-9+"px";
				oArrow.style.visibility="visible";
			}
			aItems[i].onmouseout=function(){
				setMenuArrow2();
			}
		}
	}
}

if(document.getElementById("menu")) {
	setMenuArrow();
}

function checkContact()
{
	var flag = true;
	var message = ""
	var regMail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

	var nameInput=document.formContact.name.value;
	if(nameInput.length == 0){
		  flag = false;
		  message += "\n - please enter name";
	}
		  
	var commentInput=document.formContact.comment.value;
	if(commentInput.length == 0){
		  flag = false;
		  message += "\n - please enter some comment";
	}
	regEmail=document.formContact.email.value;	
	
	if(regMail.test(regEmail) == false) {
	  flag = false;
	  message += "\n - invalid email";
	}
	if(!flag) {
	  	//var mLen = message.length;
	  	//message = message.substring(0,mLen-2) + ".";
		message ="_____________________________\n" +
		"Check following fields :\n" +
		message + "\n_____________________________" +
	 	"\n ";
	  	alert(message);
	  
	} else {
		//return true;
		document.formContact.submit();
	}
}